<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
    <meta charset="UTF-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>login</title>
    <link rel="stylesheet" type="text/css" href="css/normalize.css"/>
    <link rel="stylesheet" type="text/css" href="css/demo.css"/>
    <!--必要样式-->
    <link rel="stylesheet" type="text/css" href="css/component.css"/>
</head>
<script type="text/javascript" src="js/jquery.min.js"></script>
<body>
<div class="container demo-1">
    <div class="content">
        <div id="large-header" class="large-header">
            <canvas id="demo-canvas"></canvas>
            <div class="title-show">
                <div>电信运营商数据分析系统</div>
            </div>
            <div class="logo_box">
                <div class="login-middle">
                    <form action="/login" name="f" method="post">
                        <div class="input_outer">
                            <span class="u_user"></span>
                            <input name="username" class="text" id="username" style="color: #FFFFFF !important" type="text"
                                   placeholder="请输入账户">
                        </div>
                        <div class="input_outer">
                            <span class="us_uer"></span>
                            <input name="password" class="text" id="password"
                                   style="color: #FFFFFF !important; position:absolute; z-index:100;" value=""
                                   type="password" placeholder="请输入密码">
                        </div>
                        <div>
                            <p style="margin-left:70px;margin-top:50px;color:red;font-size:16px" id="tips"></p>
                        </div>
                        <div class="mb2"><a class="act-but submit" href="javascript:void(0);" onclick="login()" style="color: #FFFFFF">登录</a>
                        </div>
                    </form>
                </div>
            </div>
            <div class="footer-link">
                <p>Copyright © 2018 nuc_bysj
                    - Design: <a rel="nofollow" href="#" target="_parent">haocheng</a></p>
                <p>More Details <a href="http://www.nuc.edu.cn/" target="_blank" title="中北大学">中北大学</a> - from <a href="http://ss.nuc.edu.cn/" title="软件学院"
                                                                                            target="_blank">软件学院</a></p>
            </div>
        </div>

    </div>

</div><!-- /container -->
<script src="js/TweenLite.min.js"></script>
<script src="js/EasePack.min.js"></script>
<script src="js/rAF.js"></script>
<script src="js/demo-1.js"></script>
<script type="text/javascript">
    function login(){
        var username=$("#username").val();
        var password=$("#password").val();
        if(username==''||password==''){
            $("#tips").html("用户名、密码不能为空");
        }else{
            //发送ajax请求
            $.ajax({
                url:"/login",
                data:{username:username,password:password},
                type:"post",
                success:function(data){
                    if(data==1){
                        alert("您输入的用户名或密码不正确");
                    }else {
                        window.location.href = "/index"
                    }
                }
            })
        }
    }
    /*$(".login").keydown(function(event){
        if(event.which == "13")
            login();
    });*/
</script>
</body>
</html>